feat(logs): --format json and relative --since/--until shortcuts - #552
Conversation
- --format json outputs clean JSON (no UI chrome) for piping to jq etc. - --since/--until now accept relative shorthands: 1h, 30m, 2d - Suppress clack intro/outro when --format json via isRawOutputMode() Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
🚀 Package Preview Available!Install this PR's preview build with npm: npm i @base44-preview/cli@0.0.56-pr.552.22d0e10Prefer not to change any import paths? Install using npm alias so your code still imports npm i "base44@npm:@base44-preview/cli@0.0.56-pr.552.22d0e10"Or add it to your {
"dependencies": {
"base44": "npm:@base44-preview/cli@0.0.56-pr.552.22d0e10"
}
}
Preview published to npm registry — try new features instantly! |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
|
||
| private isRawOutputMode(): boolean { | ||
| return (this.opts() as Record<string, unknown>).format === "json"; | ||
| } |
There was a problem hiding this comment.
Since we just added --format to the logs command i don't think it mkaes sense to add this check to the global Base44Command, can we resolve it on the specific command?
| limit?: string; | ||
| order?: string; | ||
| json?: boolean; | ||
| format?: "text" | "json"; |
There was a problem hiding this comment.
why did you decide to go with --format json and not just --json?
since the default is already "text" no one will write --format text
| ? Number(rel[1]) * 3_600_000 | ||
| : Number(rel[1]) * 86_400_000; | ||
| return new Date(Date.now() - ms).toISOString(); | ||
| } |
There was a problem hiding this comment.
consider using a library that already solves this?
https://www.npmjs.com/package/ms maybe?
kfirstri
left a comment
There was a problem hiding this comment.
like the new flags, got some questions :)
- Replace --format json|text with --json boolean flag - Use ms library for relative time parsing in --since/--until - Revert isRawOutputMode() from Base44Command (piping already sets isNonInteractive) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Note
Description
Enhances the
base44 logscommand with two ergonomic improvements: a--jsonflag for clean, machine-readable output that's safe to pipe to tools likejq, and relative time shorthands (e.g.1h,30m,2d) for the--sinceand--untiloptions. These make scripting against function logs and querying recent activity much easier.Related Issue
None
Type of Change
Changes Made
--jsonflag tobase44 logsthat emits the log entries as formatted JSON to stdout and suppresses the "Fetched logs" outro message, keeping stdout clean for piping tojq.normalizeDatetimeto accept relative time shorthands via themslibrary, so--since 1h,--since 30m,--since 2d, etc. resolve to an absolute ISO timestamp; ISO datetimes continue to work as before.--since/--until--helpdescriptions to document the relative shorthand syntax.msruntime dependency and@types/mstypes (bundled per the zero-dependency distribution model).--jsonoutput validity and relative--sinceshortcuts.Testing
npm test)Checklist
docs/(AGENTS.md) if I made architectural changesAdditional Notes
The
--leveloption remains hidden in--help. The new dependencies (ms,@types/ms) are added todevDependenciesin line with the project's zero-dependency bundling model.🤖 Generated by Claude | 2026-06-28 06:24 UTC | 22d0e10